<?php

    importExcel();

   function importExcel(){
        error_reporting(E_ALL ^ E_NOTICE); 


            $Import_TmpFile = 'fuck.xls'; 
            require_once 'reader.php'; 
            $data = new Spreadsheet_Excel_Reader(); 
            $data->setOutputEncoding('UTF-8'); 
            $data->read($Import_TmpFile); 

          
         

    /*  for ($i = 1; $i <=$data->sheets[0]['numRows']; $i++) {
          echo $data->sheets[0]['cells'][$i][1];
          echo " ";
          echo $data->sheets[0]['cells'][$i][2];
          echo "</br>";
      }*/

      for($i=4;$i<=$data->sheets[0]['numRows']; $i++){
      	  for($j=1;$j<=17;$j++){
      	  	echo $data->sheets[0]['cells'][$i][$j];
            echo " ";
      	  }
      	  
           echo "</br>";
      }


    } 




    function export(){
        $cwd = getcwd();
        chdir('PHPExcel');
        require_once( 'PHPExcel.php');
        chdir( $cwd );
        $filename="list";//文件名
        $objPHPExcel = new PHPExcel();
        $title='小冰冰';
        $columns = array(
            '学号','姓名','密码','邮箱','手机',
            'QQ','年级','状态','地址'
        );
        $objActSheet=$objPHPExcel->getActiveSheet();
        //$this->initExcelSheet($objActSheet,$title,$columns);

       /* if ($customers){
            $i=0;$j=2;
            foreach($customers as $customer){
                if($customer['customer_grade']!=''){
               
                $objActSheet->setCellValueByColumnAndRow($i++,$j,1,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,2,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,3,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,4,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,5,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,6,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,7,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,8,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,9,false);
                $i=0;$j++;
              }
            }
        }*/

                $i=0;
                $j=1;
                $objActSheet->setCellValueByColumnAndRow($i++,$j,1,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,2,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,3,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,4,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,5,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,6,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,7,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,8,false);
                $objActSheet->setCellValueByColumnAndRow($i++,$j,9,false);

        header('Content-Type: application/vnd.ms-excel;charset=utf-8');//Excel表头
        header('Content-Disposition: attachment;filename="'.$filename.'.xls"');//内容
        header('Cache-Control: max-age=0');//缓存时间
        header("Pragma: no-cache");//禁止缓存
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        ob_clean();
        $objWriter->save('php://output');
        exit;
    }

?>